#include <iostream>
using namespace std;

class Circle{
    protected:
        double *radius;
        double area;
    public:
        Circle():radius(new double(0)){}
        Circle(double r):radius(new double(r)){
            area = 3.14 * *radius * *radius;
        }
        Circle(const Circle &other):\
            radius(new double(*other.radius)), area(other.area){
        }
        Circle &operator=(const Circle &other){
            if(this != &other){
                delete radius;
                radius = new double(*other.radius);
                area = other.area;
            }
            return *this;
        }
        ~Circle(void){
            delete radius;
            radius = nullptr;
        }
};

class Table{
    protected:
        double height;
    public:
        Table():height(0){}
        Table(double h):height(h){}
        ~Table(void){}
};

class Circle_Table:public Circle, public Table{
    private:
        string color;
    public:
        Circle_Table(){}
        Circle_Table(double r, double h, string c = "白色");
        Circle_Table(const Circle_Table &other):Circle(other), Table(other){
            color = other.color;
        }
        Circle_Table &operator=(const Circle_Table &other){
            if(this != &other){
                Circle::operator=(other);
                Table::operator=(other);
                color = other.color;
            }
            return *this;
        }
        ~Circle_Table(){}
        friend ostream &operator<<(ostream &x, const Circle_Table &O);
};

Circle_Table::Circle_Table(double r, double h, string c):
    Circle(r), Table(h), color(c){
}

ostream &operator<<(ostream &x, const Circle_Table &O){
    x << *O.radius << " " << O.area << " " << O.height << " " << O.color;
    return x;
}

int main(int argc, const char *argv[]){
    Circle_Table ct1;
    cout << ct1 << endl;
    Circle_Table ct2(2, 10, "灰色");
    cout << ct2 << endl;
    Circle_Table ct3(ct2);
    cout << ct3 << endl;
    Circle_Table ct4(3, 20, "黑色");
    cout << ct4 << endl;
    ct1 = ct4;
    cout << ct1 << endl;
    Circle_Table ct5(4, 30);
    cout << ct5 << endl;

    return 0;
}